#ifndef __BSP_FLASH_H
#define __BSP_FLASH_H

#include "ch32f10x.h"
#include "stdio.h"	
#define FLASH_PAGE_SIZE                   1024

extern uint32_t flashOffset;

int  U8toU32(uint32_t *Buf32,uint8_t *Buf8,int len);
void Flash_writeBuf(uint32_t Address, uint32_t *buf, int len);
void FLASH_EraseApp(void);


void Flash_writeFlag(uint16_t ver);
uint16_t Flash_readFlag(void);
	
void Flash_writeVersion(uint16_t ver);
uint16_t Flash_readVersion(void);

uint32_t Flash_readBaudIndex(void);
void getAllParam(void);

#endif
